// run: $exec < input
#include <iostream>

long long a, b;

int get_len(long long a)
{
	int ret = 0;
	for (; a; a /= 2) ret++;
	return ret;
}

int count_less(long long x)
{
	int l = -1, i = 0, count = 0;
	for (; x; x /= 2, i++) {
		if (!(x & 1)) l = i, count++;
	}
	int ret = i - l - 2;
	if (count == 1) ret++;
	return ret;
}


long long f(long long x)
{
	if (!x) return 0;
	int l = get_len(x);
	long long ret = 0;
	for (int i = 1; i < l; i++)
		ret += i - 1;
	ret += count_less(x);
	return ret;
}

int main()
{
	std::cin >> a >> b;
	std::cout << f(b) - f(a - 1) << '\n';
}

